<?php

namespace app\api\controller;

use app\admin\model\AuthGroupAccess;
use app\common\controller\Api;
use app\common\model\Admin;
use app\common\model\Category;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }
    /**
     * @Author LK
     * @ApiTitle (商店分类)
     * @ApiMethod (GET)
     * @ApiReturnParams (name="code", type="integer", required=true, description="")
     * @ApiReturn ({'code':1,'msg':'返回成功'})
     */
    public function shop_catrgory()
    {
        $list = Category::all(['type' => 'take_shop_type']);
        $this->success('请求成功', $list);
    }

    /**
     * @Author LK
     * @ApiTitle (商店列表)
     * @ApiMethod (GET)
     * @ApiParams (name="id", type="integer", required=true, sample="", description="分类ID")
     * @ApiReturnParams (name="code", type="integer", required=true, description="")
     * @ApiReturn ({'code':1,'msg':'返回成功'})
     */
    public function shop_list()
    {
        $param = request()->param();
        extract($param);
        $list = Admin::where('type', $id)->where('status', 'normal')->paginate();
        $this->success('请求成功', $list);
    }

     /**
     * @Author LK
     * @ApiTitle (商店详情)
     * @ApiMethod (GET)
     * @ApiParams (name="id", type="integer", required=true, sample="", description="ID")
     * @ApiReturnParams (name="code", type="integer", required=true, description="")
     * @ApiReturn ({'code':1,'msg':'返回成功'})
     */
    public function shop_info()
    {
        $param = request()->param();
        extract($param);
        $list = Admin::where('id', $id)->where('status', 'normal')->find();
        $this->success('请求成功', $list);
    }
}
